package com.example.swenp;

import rfc.HelloNachricht;
import rfc.Master;
import rfc.Message;
import rfc.MessageReply;

public class Listener_Thread {

	Master message;
	HelloNachricht login;

	public Listener_Thread(Connector c) {

		while (true) {
			
			try {

				message = c.leseNachricht();

				switch (message.getType()) {

				case 4: {

					Message msg = (Message) message;
					System.out.println("Empfangene Nachricht: "
							+ msg.getMessage());
					// ----------------------------Empfangene Nachricht auswerten
					break;
				}
				case 5: {

					MessageReply msgReply = (MessageReply) message;
					System.out.println("Status: " + msgReply.getStatus());
					//--------------------------------MessageStatus abgreifen
					
					break;
				}

				}
				this.wait(100);
				
			} catch (Exception e) {
				System.out.println(e.getMessage());
				e.printStackTrace();
			}
			
		}
		
	}

}
